import Vue from 'vue'
import App from './App.vue'
import router from './router'

import './assets/font/iconfont.css'

//引用富文本编辑器
import VueQuillEditor from 'vue-quill-editor'
//引入富文本css
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
//富文本编辑器添加实例
Vue.use(VueQuillEditor)


import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);


import NProgress from "nprogress"; // 导入 nprogress模块

import "nprogress/nprogress.css"; // 导入样式，否则看不到效果

NProgress.configure({ showSpinner: true }); // 显示右上角螺旋加载提示



import * as echarts from "echarts";
Vue.prototype.abc = echarts; // 将echarts引入与到vue的原型中，方便使用


Vue.config.productionTip = false


import axios from "axios";
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
Vue.prototype.picurl="http://127.0.0.1:8888/api/private/v1/";

//请求拦截器 调用接口之前执行
axios.interceptors.request.use(function (config) {
  NProgress.start(); //开启进度条
  config.headers.Authorization = sessionStorage.getItem("token")
  return config;
})

axios.interceptors.response.use(function (config) {
  NProgress.done(); //完成进度条
  // alert(2)
  return config.data;
})
//挂载vue原型   this访问   this.request
Vue.prototype.request = axios;


import './assets/css/global.css'





//注册全局过滤器
Vue.filter('dateFormat', function(originVal) {

  const dt = new Date(originVal)

  const y = dt.getFullYear()

  const m = (dt.getMonth() + 1 + '').padStart(2, '0') //不足两位补0
  const d = (dt.getDate() + '').padStart(2, '0')

  const hh = (dt.getHours() + '').padStart(2, '0')
  const mm = (dt.getMinutes() + '').padStart(2, '0')
  const ss = (dt.getSeconds() + '').padStart(2, '0')

  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
      return dt
})

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
